$(function(){
    //点击切换侧边栏
    $(".supplier-side-container .nav-item").on("click",function(){
        var height = $(this).children('.nav-children').children().length*45;
        if($(this).children('.nav-children').length){
            if($(this).hasClass('up')){
                $(this).removeClass('up');
                $(this).children('.nav-children').css('height',0);
            }else{
                $('.supplier-side-container .supplier-nav ul').css('height',0).parent().removeClass('up');
                $(this).addClass('up');
                $(this).children('.nav-children').css('height',height);
            }
        }else{
            $(this).addClass("on").siblings('.nav-item').removeClass('on');
            $(".supplier-side-container .nav-item .nav-children li").removeClass('active');
        }
    });
    $(".supplier-side-container .nav-item .nav-children li").on("click",function(e){
        $(this).parents('.nav-list').children('.nav-item').removeClass('on');
        $('.supplier-side-container .nav-item .nav-children li').removeClass('active');
        $(this).addClass('active');
        //阻止冒泡
        e.stopPropagation()
    });
});
